package scuts.core.extensions;

import scuts.core.types.Option;

class Options {
  public static inline function isSome (o:Option<Dynamic>):Bool {
    return switch (o) {
      case Some(_): true;
      case None: false;
    }
  }
  
  public static inline function isNone (o:Option<Dynamic>):Bool {
    return !isSome(o);
  }
  
  public static inline function value <T>(o:Option<T>):T {
    return switch (o) {
      case Some(v): v;
      case None: throw "You cannot extract a value of Option.None";
    }
  }

  
  
}